package com.hua.controller;

import com.hua.common.Response;
import com.hua.domain.Teabottom;
import com.hua.service.TeabottomService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import javax.annotation.Resource;

/**
 * @program: git
 * @description: 茶底操作
 * @author: 黄燕峰
 * @create: 2022-10-21 19:58
 **/
@Api(value = "茶底操作")
@RestController
@RequestMapping("/teabottom")
public class TeaBottomController {
    @Resource
    private TeabottomService teabottomService;

    @ApiOperation(value = "查询所有茶底")
    @GetMapping("/getTeaBottom")
    public Response<List<Teabottom>> getTeaBottom() {
        return teabottomService.getAll();
    }

    @ApiOperation(value = "修改茶底")
    @PutMapping("/updateTeaBottom")
    public Response<String> updateTeaBottom(@RequestBody Teabottom teabottom) {
        return teabottomService.updateTeabottomById(teabottom);
    }

    @ApiOperation(value = "增加茶底")
    @PostMapping("/insertTeaBottom")
    public Response<String> insertTeaBottom(@RequestBody Teabottom teabottom){
        return teabottomService.insertTeaBottom(teabottom);
    }

    @ApiOperation(value = "删除茶底")
    @DeleteMapping("/deleteTeaBottom/{teaId}")
    public Response<String> deleteTeaBottom(@PathVariable("teaId") Integer teaId) {
        System.out.println(teaId);
        return teabottomService.deleteTeaBottomById(teaId);
    }

}
